Optimal. Leaf size=317 \[ \frac {\left (\frac {1}{16}+\frac {i}{16}\right ) ((1+i) A+B) \text {ArcTan}\left (1-\sqrt {2} \sqrt {\tan (c+d x)}\right )}{\sqrt {2} a^3 d}-\frac {\left (\frac {1}{16}+\frac {i}{16}\right ) ((1+i) A+B) \text {ArcTan}\left (1+\sqrt {2} \sqrt {\tan (c+d x)}\right )}{\sqrt {2} a^3 d}+\frac {(2 i A+(1-i) B) \log \left (1-\sqrt {2} \sqrt {\tan (c+d x)}+\tan (c+d x)\right )}{32 \sqrt {2} a^3 d}-\frac {(2 i A+(1-i) B) \log \left (1+\sqrt {2} \sqrt {\tan (c+d x)}+\tan (c+d x)\right )}{32 \sqrt {2} a^3 d}+\frac {(i A-B) \sqrt {\tan (c+d x)}}{6 d (a+i a \tan (c+d x))^3}+\frac {(i A+2 B) \sqrt {\tan (c+d x)}}{12 a d (a+i a \tan (c+d x))^2}+\frac {B \sqrt {\tan (c+d x)}}{8 d \left (a^3+i a^3 \tan (c+d x)\right )} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.42, antiderivative size = 317, normalized size of antiderivative = 1.00, number of steps
used = 13, number of rules used = 9, integrand size = 36, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3676, 3677,
3615, 1182, 1176, 631, 210, 1179, 642} \begin {gather*} \frac {\left (\frac {1}{16}+\frac {i}{16}\right ) (B+(1+i) A) \text {ArcTan}\left (1-\sqrt {2} \sqrt {\tan (c+d x)}\right )}{\sqrt {2} a^3 d}-\frac {\left (\frac {1}{16}+\frac {i}{16}\right ) (B+(1+i) A) \text {ArcTan}\left (\sqrt {2} \sqrt {\tan (c+d x)}+1\right )}{\sqrt {2} a^3 d}+\frac {(2 i A+(1-i) B) \log \left (\tan (c+d x)-\sqrt {2} \sqrt {\tan (c+d x)}+1\right )}{32 \sqrt {2} a^3 d}-\frac {(2 i A+(1-i) B) \log \left (\tan (c+d x)+\sqrt {2} \sqrt {\tan (c+d x)}+1\right )}{32 \sqrt {2} a^3 d}+\frac {B \sqrt {\tan (c+d x)}}{8 d \left (a^3+i a^3 \tan (c+d x)\right )}+\frac {(-B+i A) \sqrt {\tan (c+d x)}}{6 d (a+i a \tan (c+d x))^3}+\frac {(2 B+i A) \sqrt {\tan (c+d x)}}{12 a d (a+i a \tan (c+d x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 210
Rule 631
Rule 642
Rule 1176
Rule 1179
Rule 1182
Rule 3615
Rule 3676
Rule 3677
Rubi steps
\begin {align*} \int \frac {\sqrt {\tan (c+d x)} (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^3} \, dx &=\frac {(i A-B) \sqrt {\tan (c+d x)}}{6 d (a+i a \tan (c+d x))^3}-\frac {\int \frac {\frac {1}{2} a (i A-B)-\frac {1}{2} a (5 A-7 i B) \tan (c+d x)}{\sqrt {\tan (c+d x)} (a+i a \tan (c+d x))^2} \, dx}{6 a^2}\\ &=\frac {(i A-B) \sqrt {\tan (c+d x)}}{6 d (a+i a \tan (c+d x))^3}+\frac {(i A+2 B) \sqrt {\tan (c+d x)}}{12 a d (a+i a \tan (c+d x))^2}-\frac {\int \frac {3 i a^2 A-3 a^2 (A-2 i B) \tan (c+d x)}{\sqrt {\tan (c+d x)} (a+i a \tan (c+d x))} \, dx}{24 a^4}\\ &=\frac {(i A-B) \sqrt {\tan (c+d x)}}{6 d (a+i a \tan (c+d x))^3}+\frac {(i A+2 B) \sqrt {\tan (c+d x)}}{12 a d (a+i a \tan (c+d x))^2}+\frac {B \sqrt {\tan (c+d x)}}{8 d \left (a^3+i a^3 \tan (c+d x)\right )}-\frac {\int \frac {3 a^3 (2 i A+B)+3 i a^3 B \tan (c+d x)}{\sqrt {\tan (c+d x)}} \, dx}{48 a^6}\\ &=\frac {(i A-B) \sqrt {\tan (c+d x)}}{6 d (a+i a \tan (c+d x))^3}+\frac {(i A+2 B) \sqrt {\tan (c+d x)}}{12 a d (a+i a \tan (c+d x))^2}+\frac {B \sqrt {\tan (c+d x)}}{8 d \left (a^3+i a^3 \tan (c+d x)\right )}-\frac {\text {Subst}\left (\int \frac {3 a^3 (2 i A+B)+3 i a^3 B x^2}{1+x^4} \, dx,x,\sqrt {\tan (c+d x)}\right )}{24 a^6 d}\\ &=\frac {(i A-B) \sqrt {\tan (c+d x)}}{6 d (a+i a \tan (c+d x))^3}+\frac {(i A+2 B) \sqrt {\tan (c+d x)}}{12 a d (a+i a \tan (c+d x))^2}+\frac {B \sqrt {\tan (c+d x)}}{8 d \left (a^3+i a^3 \tan (c+d x)\right )}-\frac {\left (\left (\frac {1}{16}+\frac {i}{16}\right ) ((1+i) A+B)\right ) \text {Subst}\left (\int \frac {1+x^2}{1+x^4} \, dx,x,\sqrt {\tan (c+d x)}\right )}{a^3 d}-\frac {(2 i A+(1-i) B) \text {Subst}\left (\int \frac {1-x^2}{1+x^4} \, dx,x,\sqrt {\tan (c+d x)}\right )}{16 a^3 d}\\ &=\frac {(i A-B) \sqrt {\tan (c+d x)}}{6 d (a+i a \tan (c+d x))^3}+\frac {(i A+2 B) \sqrt {\tan (c+d x)}}{12 a d (a+i a \tan (c+d x))^2}+\frac {B \sqrt {\tan (c+d x)}}{8 d \left (a^3+i a^3 \tan (c+d x)\right )}-\frac {\left (\left (\frac {1}{32}+\frac {i}{32}\right ) ((1+i) A+B)\right ) \text {Subst}\left (\int \frac {1}{1-\sqrt {2} x+x^2} \, dx,x,\sqrt {\tan (c+d x)}\right )}{a^3 d}-\frac {\left (\left (\frac {1}{32}+\frac {i}{32}\right ) ((1+i) A+B)\right ) \text {Subst}\left (\int \frac {1}{1+\sqrt {2} x+x^2} \, dx,x,\sqrt {\tan (c+d x)}\right )}{a^3 d}+\frac {(2 i A+(1-i) B) \text {Subst}\left (\int \frac {\sqrt {2}+2 x}{-1-\sqrt {2} x-x^2} \, dx,x,\sqrt {\tan (c+d x)}\right )}{32 \sqrt {2} a^3 d}+\frac {(2 i A+(1-i) B) \text {Subst}\left (\int \frac {\sqrt {2}-2 x}{-1+\sqrt {2} x-x^2} \, dx,x,\sqrt {\tan (c+d x)}\right )}{32 \sqrt {2} a^3 d}\\ &=\frac {(2 i A+(1-i) B) \log \left (1-\sqrt {2} \sqrt {\tan (c+d x)}+\tan (c+d x)\right )}{32 \sqrt {2} a^3 d}-\frac {(2 i A+(1-i) B) \log \left (1+\sqrt {2} \sqrt {\tan (c+d x)}+\tan (c+d x)\right )}{32 \sqrt {2} a^3 d}+\frac {(i A-B) \sqrt {\tan (c+d x)}}{6 d (a+i a \tan (c+d x))^3}+\frac {(i A+2 B) \sqrt {\tan (c+d x)}}{12 a d (a+i a \tan (c+d x))^2}+\frac {B \sqrt {\tan (c+d x)}}{8 d \left (a^3+i a^3 \tan (c+d x)\right )}--\frac {\left (\left (\frac {1}{16}+\frac {i}{16}\right ) ((1+i) A+B)\right ) \text {Subst}\left (\int \frac {1}{-1-x^2} \, dx,x,1+\sqrt {2} \sqrt {\tan (c+d x)}\right )}{\sqrt {2} a^3 d}-\frac {\left (\left (\frac {1}{16}+\frac {i}{16}\right ) ((1+i) A+B)\right ) \text {Subst}\left (\int \frac {1}{-1-x^2} \, dx,x,1-\sqrt {2} \sqrt {\tan (c+d x)}\right )}{\sqrt {2} a^3 d}\\ &=\frac {\left (\frac {1}{16}+\frac {i}{16}\right ) ((1+i) A+B) \tan ^{-1}\left (1-\sqrt {2} \sqrt {\tan (c+d x)}\right )}{\sqrt {2} a^3 d}-\frac {\left (\frac {1}{16}+\frac {i}{16}\right ) ((1+i) A+B) \tan ^{-1}\left (1+\sqrt {2} \sqrt {\tan (c+d x)}\right )}{\sqrt {2} a^3 d}+\frac {(2 i A+(1-i) B) \log \left (1-\sqrt {2} \sqrt {\tan (c+d x)}+\tan (c+d x)\right )}{32 \sqrt {2} a^3 d}-\frac {(2 i A+(1-i) B) \log \left (1+\sqrt {2} \sqrt {\tan (c+d x)}+\tan (c+d x)\right )}{32 \sqrt {2} a^3 d}+\frac {(i A-B) \sqrt {\tan (c+d x)}}{6 d (a+i a \tan (c+d x))^3}+\frac {(i A+2 B) \sqrt {\tan (c+d x)}}{12 a d (a+i a \tan (c+d x))^2}+\frac {B \sqrt {\tan (c+d x)}}{8 d \left (a^3+i a^3 \tan (c+d x)\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 2.01, size = 272, normalized size = 0.86 \begin {gather*} \frac {e^{-4 i (c+d x)} \left (\left (A+i B+A e^{2 i (c+d x)}-2 i B e^{2 i (c+d x)}\right ) \left (-1-2 e^{2 i (c+d x)}+e^{4 i (c+d x)}+2 e^{6 i (c+d x)}\right )-3 A e^{6 i (c+d x)} \sqrt {-1+e^{4 i (c+d x)}} \text {ArcTan}\left (\sqrt {-1+e^{4 i (c+d x)}}\right )-6 (A-i B) e^{6 i (c+d x)} \sqrt {-1+e^{2 i (c+d x)}} \sqrt {1+e^{2 i (c+d x)}} \tanh ^{-1}\left (\sqrt {\frac {-1+e^{2 i (c+d x)}}{1+e^{2 i (c+d x)}}}\right )\right ) \sec (c+d x) (\cos (3 (c+d x))-i \sin (3 (c+d x)))}{96 a^3 d \sqrt {\tan (c+d x)}} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.13, size = 152, normalized size = 0.48
method | result | size |
derivativedivides | \(\frac {\frac {-i B \left (\tan ^{\frac {5}{2}}\left (d x +c \right )\right )+\left (-\frac {10 B}{3}-\frac {2 i A}{3}\right ) \left (\tan ^{\frac {3}{2}}\left (d x +c \right )\right )+\left (i B -2 A \right ) \left (\sqrt {\tan }\left (d x +c \right )\right )}{8 \left (\tan \left (d x +c \right )-i\right )^{3}}-\frac {A \arctan \left (\frac {2 \left (\sqrt {\tan }\left (d x +c \right )\right )}{\sqrt {2}-i \sqrt {2}}\right )}{4 \left (\sqrt {2}-i \sqrt {2}\right )}+\frac {4 \left (\frac {A}{16}-\frac {i B}{16}\right ) \arctan \left (\frac {2 \left (\sqrt {\tan }\left (d x +c \right )\right )}{\sqrt {2}+i \sqrt {2}}\right )}{\sqrt {2}+i \sqrt {2}}}{d \,a^{3}}\) | \(152\) |
default | \(\frac {\frac {-i B \left (\tan ^{\frac {5}{2}}\left (d x +c \right )\right )+\left (-\frac {10 B}{3}-\frac {2 i A}{3}\right ) \left (\tan ^{\frac {3}{2}}\left (d x +c \right )\right )+\left (i B -2 A \right ) \left (\sqrt {\tan }\left (d x +c \right )\right )}{8 \left (\tan \left (d x +c \right )-i\right )^{3}}-\frac {A \arctan \left (\frac {2 \left (\sqrt {\tan }\left (d x +c \right )\right )}{\sqrt {2}-i \sqrt {2}}\right )}{4 \left (\sqrt {2}-i \sqrt {2}\right )}+\frac {4 \left (\frac {A}{16}-\frac {i B}{16}\right ) \arctan \left (\frac {2 \left (\sqrt {\tan }\left (d x +c \right )\right )}{\sqrt {2}+i \sqrt {2}}\right )}{\sqrt {2}+i \sqrt {2}}}{d \,a^{3}}\) | \(152\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 631 vs. \(2 (244) = 488\).
time = 0.59, size = 631, normalized size = 1.99 \begin {gather*} -\frac {{\left (3 \, a^{3} d \sqrt {\frac {i \, A^{2} + 2 \, A B - i \, B^{2}}{a^{6} d^{2}}} e^{\left (6 i \, d x + 6 i \, c\right )} \log \left (\frac {2 \, {\left ({\left (a^{3} d e^{\left (2 i \, d x + 2 i \, c\right )} + a^{3} d\right )} \sqrt {\frac {-i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}} \sqrt {\frac {i \, A^{2} + 2 \, A B - i \, B^{2}}{a^{6} d^{2}}} + {\left (A - i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )}\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{i \, A + B}\right ) - 3 \, a^{3} d \sqrt {\frac {i \, A^{2} + 2 \, A B - i \, B^{2}}{a^{6} d^{2}}} e^{\left (6 i \, d x + 6 i \, c\right )} \log \left (-\frac {2 \, {\left ({\left (a^{3} d e^{\left (2 i \, d x + 2 i \, c\right )} + a^{3} d\right )} \sqrt {\frac {-i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}} \sqrt {\frac {i \, A^{2} + 2 \, A B - i \, B^{2}}{a^{6} d^{2}}} - {\left (A - i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )}\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{i \, A + B}\right ) - 24 \, a^{3} d \sqrt {-\frac {i \, A^{2}}{64 \, a^{6} d^{2}}} e^{\left (6 i \, d x + 6 i \, c\right )} \log \left (\frac {{\left (8 \, {\left (a^{3} d e^{\left (2 i \, d x + 2 i \, c\right )} + a^{3} d\right )} \sqrt {\frac {-i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}} \sqrt {-\frac {i \, A^{2}}{64 \, a^{6} d^{2}}} + A\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{8 \, a^{3} d}\right ) + 24 \, a^{3} d \sqrt {-\frac {i \, A^{2}}{64 \, a^{6} d^{2}}} e^{\left (6 i \, d x + 6 i \, c\right )} \log \left (-\frac {{\left (8 \, {\left (a^{3} d e^{\left (2 i \, d x + 2 i \, c\right )} + a^{3} d\right )} \sqrt {\frac {-i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}} \sqrt {-\frac {i \, A^{2}}{64 \, a^{6} d^{2}}} - A\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{8 \, a^{3} d}\right ) + 2 \, {\left (2 \, {\left (-i \, A - 2 \, B\right )} e^{\left (6 i \, d x + 6 i \, c\right )} - {\left (5 i \, A + 4 \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} - {\left (4 i \, A - B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} - i \, A + B\right )} \sqrt {\frac {-i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}}\right )} e^{\left (-6 i \, d x - 6 i \, c\right )}}{96 \, a^{3} d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.83, size = 131, normalized size = 0.41 \begin {gather*} -\frac {\left (i + 1\right ) \, \sqrt {2} A \arctan \left (\left (\frac {1}{2} i + \frac {1}{2}\right ) \, \sqrt {2} \sqrt {\tan \left (d x + c\right )}\right )}{16 \, a^{3} d} - \frac {\left (i - 1\right ) \, \sqrt {2} {\left (A - i \, B\right )} \arctan \left (-\left (\frac {1}{2} i - \frac {1}{2}\right ) \, \sqrt {2} \sqrt {\tan \left (d x + c\right )}\right )}{16 \, a^{3} d} - \frac {3 i \, B \tan \left (d x + c\right )^{\frac {5}{2}} + 2 i \, A \tan \left (d x + c\right )^{\frac {3}{2}} + 10 \, B \tan \left (d x + c\right )^{\frac {3}{2}} + 6 \, A \sqrt {\tan \left (d x + c\right )} - 3 i \, B \sqrt {\tan \left (d x + c\right )}}{24 \, a^{3} d {\left (\tan \left (d x + c\right ) - i\right )}^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 6.59, size = 239, normalized size = 0.75 \begin {gather*} \frac {\frac {B\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}}{8\,a^3\,d}-\frac {B\,{\mathrm {tan}\left (c+d\,x\right )}^{5/2}}{8\,a^3\,d}+\frac {B\,{\mathrm {tan}\left (c+d\,x\right )}^{3/2}\,5{}\mathrm {i}}{12\,a^3\,d}}{-{\mathrm {tan}\left (c+d\,x\right )}^3\,1{}\mathrm {i}-3\,{\mathrm {tan}\left (c+d\,x\right )}^2+\mathrm {tan}\left (c+d\,x\right )\,3{}\mathrm {i}+1}+\frac {-\frac {A\,{\mathrm {tan}\left (c+d\,x\right )}^{3/2}}{12\,a^3\,d}+\frac {A\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}\,1{}\mathrm {i}}{4\,a^3\,d}}{-{\mathrm {tan}\left (c+d\,x\right )}^3\,1{}\mathrm {i}-3\,{\mathrm {tan}\left (c+d\,x\right )}^2+\mathrm {tan}\left (c+d\,x\right )\,3{}\mathrm {i}+1}-\frac {{\left (-1\right )}^{1/4}\,A\,\mathrm {atan}\left ({\left (-1\right )}^{1/4}\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}\right )}{8\,a^3\,d}-\frac {{\left (-1\right )}^{1/4}\,A\,\mathrm {atanh}\left ({\left (-1\right )}^{1/4}\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}\right )}{8\,a^3\,d}-\frac {\sqrt {-\frac {1}{256}{}\mathrm {i}}\,B\,\mathrm {atan}\left (16\,\sqrt {-\frac {1}{256}{}\mathrm {i}}\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}\right )\,2{}\mathrm {i}}{a^3\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________